﻿using System.Collections.Generic;

namespace com.foxmail.wyyuan1991.Assignment.Solver.Data
{
    public class CapacityLagrangeMultiplier //容量约束的拉格朗日乘子
    {
        //internal INetwork net;
        private Dictionary<IArc, double> _Dic = new Dictionary<IArc, double>();
        public double this[IArc a]
        {
            get
            {
                if (_Dic.ContainsKey(a))
                {
                    return _Dic[a];
                }
                else
                {
                    return 0;
                }
            }
            set
            {
                if (!_Dic.ContainsKey(a)) _Dic.Add(a, double.MaxValue);
                _Dic[a] = value;
            }
        }
        public void Clear()
        {
            this._Dic.Clear();
        }
    }
    public class SCLagrangeMultiplier //广义边约束的拉格朗日乘子
    {
        //internal INetwork net;
        private Dictionary<SideConstraint, double> _Dic = new Dictionary<SideConstraint, double>();
        public double this[SideConstraint sc]
        {
            get
            {
                if (_Dic.ContainsKey(sc))
                {
                    return _Dic[sc];
                }
                else
                {
                    return 0;
                }
            }
            set
            {
                if (!_Dic.ContainsKey(sc)) _Dic.Add(sc, double.MaxValue);
                _Dic[sc] = value;
            }
        }
        public void Clear()
        {
            this._Dic.Clear();
        }
    }
}
